package chu.dejian.ui.unused;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.widget.Toast;
import com.sam.blemodule.R;
import com.sam.ui.base.fragment.BaseFragment;
import com.sam.widget.listview.deprecate_menu_list.SwipeMenuListView;

import java.util.List;
import chu.dejian.adapter.SendedRequestAdapter;
import chu.dejian.db.DBHelper;
import chu.dejian.entity.ContactEntity;
import chu.dejian.entity.SendedRequestEntity;

/**
 * Created by Administrator on 2016/7/20 0020.
 */
public class TestFragment extends BaseFragment {
    private SwipeMenuListView lv;

    @Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.fragment_test);
    }

    @Override
    protected void findView() {
        lv = (SwipeMenuListView) findViewById(R.id.lv);
    }

    @Override
    protected void initView() {
        List<ContactEntity> requestList = SendedRequestEntity.convertToContactEntity(DBHelper.getInstance().getSendedRequestDao().getAllRequest());
        if(requestList == null || requestList.size() == 0) Toast.makeText(getActivity(),"no data",Toast.LENGTH_SHORT).show();
        else lv.setAdapter(new SendedRequestAdapter(requestList));
    }
}
